<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>修改密码</title>
<%include("/common/include.html"){}%>
<link rel="stylesheet" type="text/css" href="${cxt!}/sb/css/bootstrap.css">
<style>
	div,form,span,input{
		margin:0px;
		padding:0px;
	}
	span{
		display:inline-block;
	}
</style>
 </head>
<body>
	   <div style="width:80%;margin:auto;margin-top:10%">
		<form  id="updatepassword_form" action="info/mdPwd" method="post" rel="main_right"    class="form-horizontal" role="form">
		  <div class="form-group">
		     
		      <input type="text"  value="密码过于简单，请修改密码" readonly = "true" >
		      <input type="text"  value="新密码需6位以上" readonly = "true">
		      <input type="text"  value="以字母开头包含数字、符号" readonly = "true">
		  </div>	
		  <div class="form-group">
		      <span class="text-primary">用户名 :</span>
		      <input type="text" class="form-control"    id="username" name="username" value="${username! }" readonly = "true" required>
		  </div>	
		 
		  <div class="form-group">
		      <span class="text-primary">旧密码  :</span>
		      <input type="text" class="form-control"    id="oldPassword" name="oldPassword" placeholder="请输入原始密码"  required>
		  </div>	
		  <div class="form-group">
		      <span class="text-primary">新密码:</span>
		      <input type="text" class="form-control"   id="newPassword" name="newPassword" placeholder="请输入新密码"  required>
		  </div>	
		  <div class="form-group">
		      <span class="text-primary">确认新密码:</span>
		      <div class="required">
		      <input type="text" class="form-control"  id="confirmPassword" name="confirmPassword" placeholder="请再次输入新密码"  required>
		      </div>
		  </div>
		 <!--  <div class="form-group">
		      <span class="text-primary">手机验证:</span>
		      <input type="text" class="form-control" placeholder="">
		  </div>
		  <div class="form-group">
		      <a href="javascript:void(0)">获取验证码</a>
		  </div>		
		  <div class="form-group">
		      <a class="btn btn-success" style="width:100%">确&nbsp;&nbsp;定</a>
		  </div>	 -->	  
		</form>
	</div>
<script>
</script>
</body>
</html>
<script type="text/javascript">

var submitNow=function($dialog, $grid, $tree, $pjq){

	var username = $.trim($("#username").val());
	var oldPwd = $.trim($("#oldPassword").val());
	var newpwd = $.trim($("#newPassword").val());
	var confirmPwd = $.trim($("#confirmPassword").val());
	if(username == null||username.length<1){
		$.alert($pjq, "用户名不可为空!");
		return false;
	}
	if(oldPwd == null||oldPwd.length<1){
		$.alert($pjq, "旧密码不可为空!");
		return false;
	}
	
	if(newpwd == null||newpwd.length<1){
		$.alert($pjq, "新密码不可为空！");
		return false;
	}
	if(confirmPwd == null||confirmPwd.length<1){
		$.alert($pjq, "确认新密码不可为空");
		return false;
	}
	if(confirmPwd != newpwd){
		$.alert($pjq, "两次输入密码不一致");
		return false;
	}
	
	//复杂度
	
    if(newpwd.length< 6){  
    	$.alert($pjq, "密码至少是6位");
		return false;
    }  
  /*   if(newpwd.matches("^[a-zA-z](.*)") && password.matches("(.*)[-`=\\\\\\[\\];',./~!@#$%^&*()_+|{}:\"<>?]+(.*)") && password.matches("(.*)\\d+(.*)")){  
    
    }else{
    	$.alert($pjq, "必须以字母开头,必须包含特殊字符 ,必须包含数字");
		return false;
    } */
    
	var url = "${cxt!}/userManage/passLoginChange";
	var data=sy.serializeObject($('#updatepassword_form'));
	$.post(url,data ,function(result){
		
		if(result == "true"){
			//$grid.datagrid('reload');
			$.slideMsg("修改成功！", $pjq);	
			$dialog.dialog('destroy');
		}else{
		
			$.alert($pjq, result);
		}
	});
	
} 
var submitForm = function($dialog, $grid, $tree, $pjq) {
	submitNow($dialog, $grid, $tree, $pjq);
}

</script>